﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;

public partial class SearchProduct : System.Web.UI.Page
{
    string keyword;
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!Page.IsPostBack)
        {
            keyword = Request["keyword"];

            string sql = "SELECT *FROM SANPHAM WHERE tensanpham like '%" + keyword + "%'";
            DataTable table = Database.GetData(sql);
            DataList1.DataSource = table;
            DataList1.DataBind();
        }
    }

    public void BuyProduct(object sender, EventArgs e)
    {
        ImageButton image = (ImageButton)sender;
        String ProductID = image.CommandArgument;

        Response.Redirect("Muahang.aspx?sanpham=" + ProductID);
    }
}